<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!--区域-->
    <div id="app">
        <input type="text" v-model.number= 'n1'> + <input type="text" v-model.number='n2'> = <span>{{ n1 + n2 }}</span>
        <br>
        <input type="text" v-model.trim='username'>
        <button @click='getName'>获取用户名</button>
        <br>
        <input type="text" v-model.lazy='username'>
    </div>

    <!--引入-->
    <script src="./lib/vue-2.6.12.js"></script>

    <!--创建实例对象-->
    <script>
        const vm = new Vue({
            el: '#app',
            data: {
                username: 'zhangsan',
                n1: 1,
                n2: 2,
            },
            methods: {
                getName () {
                    console.log(this.username)
                }
            }
        })
    </script>
</body>
</html>